//
//  HMCycleCell.m
//  轮播
//
//  Created by HaoYoson on 16/7/3.
//  Copyright © 2016年 HaoYoson. All rights reserved.
//

#import "HMCycleCell.h"
#import "Masonry.h"

@interface HMCycleCell ()

@property (weak, nonatomic) UIImageView *imageView;

@end

@implementation HMCycleCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}
- (void)setImageURL:(NSURL *)imageURL {
    _imageURL = imageURL;

    // url -> data
    NSData *data = [NSData dataWithContentsOfURL:imageURL];

    // data -> image
    UIImage *image = [UIImage imageWithData:data];

    self.imageView.image = image;
}

- (void)setupUI {
    UIImageView *imageView = [[UIImageView alloc] init];
    [self.contentView addSubview:imageView];

    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];

    self.imageView = imageView;
}

@end
